use "Study 2 Britain.dta"

* Norms

**********************
*      Figure 3      *
**********************
sum Q1b if Q1b!=997 & group==1, detail 
histogram Q1b if Q1b!=997 & group==1, yscale(r(0 0.06)) xscale(r(0 100)) ylabel(#4) xlabel(#6) xtitle("{&larr} Disapprove/Approve {&rarr}") percent ytitle("Percent of Respondents") note("N = 453")
graph save Graph "Figure 3.gph"


* Priming Norms  

**********************
*      Figure 4      *
**********************


histogram them if (politics_scale_profile_update<3 | politics_scale_profile_update>5), by(group, note("N = 2158") xrescale row(1)) subtitle(, fcolor(ltblue*0.2)) bfcolor(ltblue) blcolor(blue*0.5) bin(4) percent kdensity kdenopts(lcolor(%40) lpattern(solid) width(27) gaussian) ylabel(0(20)70) by(, title("Strong Identifiers")) by(, legend(off)) xtitle("Voted to Give (£)") ytitle("Percent of Respondents") yline(20 40 60)
graph save Graph "Figure 4c.gph"

histogram them if (politics_scale_profile_update==3 | politics_scale_profile_update==5), by(group, note("N = 2233") xrescale row(1)) subtitle(, fcolor(ltblue*0.2)) bfcolor(ltblue) blcolor(blue*0.5) bin(4) percent kdensity kdenopts(lcolor(%40) lpattern(solid) width(27) gaussian) ylabel(0(20)70) by(, title("Weak Identifiers")) by(, legend(off)) xtitle("Voted to Give (£)") ytitle("Percent of Respondents") yline(20 40 60)
graph save Graph "Figure 4b.gph"

histogram them, by(group, note("N = 4391") xrescale row(1)) subtitle(, fcolor(ltblue*0.2)) bfcolor(ltblue) blcolor(blue*0.5) bin(4) percent kdensity kdenopts(lcolor(%40) lpattern(solid) width(27) gaussian) ylabel(0(20)70) by(, title("Weak and Strong Identifiers")) by(, legend(off)) xtitle("Voted to Give (£)") ytitle("Percent of Respondents") yline(20 40 60)
graph save Graph "Figure 4a.gph"

bysort group: sum them, detail
bysort group: sum them if (politics_scale_profile_update==3 | politics_scale_profile_update==5), detail
bysort group: sum them if  (politics_scale_profile_update<3 | politics_scale_profile_update>5), detail

*T-test of differences
ttest them if group!=3, by(group) 
ttest them if group!=1, by(group)

ttest them if group!=3 & (politics_scale_profile_update==3 | politics_scale_profile_update==5), by(group) 
ttest them if group!=1 & (politics_scale_profile_update==3 | politics_scale_profile_update==5), by(group) 

ttest them if group!=3 &  (politics_scale_profile_update<3 | politics_scale_profile_update>5), by(group) 
ttest them if group!=1 &  (politics_scale_profile_update<3 | politics_scale_profile_update>5), by(group)

*Fisher-Pitman permutation test of differences
permtest2 them if group!=3, by(group) 
permtest2 them if group!=1, by(group)

permtest2  them if group!=3 & (politics_scale_profile_update==3 | politics_scale_profile_update==5), by(group) 
permtest2  them if group!=1 & (politics_scale_profile_update==3 | politics_scale_profile_update==5), by(group) 

permtest2  them if group!=3 &  (politics_scale_profile_update<3 | politics_scale_profile_update>5), by(group) 
permtest2  them if group!=1 &  (politics_scale_profile_update<3 | politics_scale_profile_update>5), by(group)

*Strong vs Weak 
recode politics_scale_profile_update (3=0 "Weak") (5=0) (1/2 = 1 "Strong") (6/7=1) (4=.) (8=.), into(ID_strength)
reg them group##ID_strength if group!=1 
reg them ID_strength if group==1

*Strong vs Weak: Norm knowledge
recode Q1b (0/49 = 1) (50/100=0) (997=0) , into(norm_knowledge)
ttest them, by(norm_knowledge)
prtest norm_knowledge, by(ID_strength)

*Strong vs Weak: Norm sensitive
recode Q1b (50/100=.) (997=.) , into(norm_sensitive)
pwcorr norm_sensitive them, sig
ttest norm_sensitive, by(ID_strength)


**********************
*     Appendix 7     *
**********************

recode group (2=0 "Implicit Prime") (3=1 "Explicit Prime"), into(ExvsIm)
recode group (2=1 "Implicit Prime") (1=0 "No Prime"), into(NoPvsIm)

logit NoPvsIm age profile_gender i.politics_scale_profile_update if group!=3
test age profile_gender 2.politics_scale_profile_update 3.politics_scale_profile_update 5.politics_scale_profile_update 6.politics_scale_profile_update 7.politics_scale_profile_update
coefplot, drop(_cons) xline(0) 
graph save Graph "Figure 7a.gph"

logit ExvsIm age profile_gender i.politics_scale_profile_update if group!=1
test age profile_gender 2.politics_scale_profile_update 3.politics_scale_profile_update 5.politics_scale_profile_update 6.politics_scale_profile_update 7.politics_scale_profile_update
coefplot, drop(_cons) xline(0) 
graph save Graph "Figure 7b.gph"

**********************
*     Appendix 8     *
**********************

*Left
sum Q1b if Q1b!=997 & politics_scale_profile_update<4 & group==1, detail 
histogram Q1b if politics_scale_profile_update<4 & Q1b!=997 & group==1, yscale(r(0 0.06)) xscale(r(0 100)) ylabel(#4) xlabel(#6) xtitle("Approval")
graph save Graph "Figure A5a.gph"

*Right
sum Q1b if Q1b!=997 & politics_scale_profile_update>4 & group==1, detail 
histogram Q1b if politics_scale_profile_update>4 & Q1b!=997 & group==1, yscale(r(0 0.06)) xscale(r(0 100)) ylabel(#4) xlabel(#6) xtitle("Approval")
graph save Graph "Figure A5b.gph"

**********************
*     Appendix 9     *
**********************

recode them (300=1) (0/299 = 0), gen(d300)
prtest d300 if group!=3 & (politics_scale_profile_update==3 | politics_scale_profile_update==5), by(group) 
prtest d300 if group!=1 & (politics_scale_profile_update==3 | politics_scale_profile_update==5), by(group) 

prtest d300 if group!=3 & (politics_scale_profile_update<3 | politics_scale_profile_update>5), by(group) 
prtest d300 if group!=1 & (politics_scale_profile_update<3 | politics_scale_profile_update>5), by(group)


recode them (0=1) (1/300 = 0), gen(d0)

prtest d0 if group!=3 & (politics_scale_profile_update==3 | politics_scale_profile_update==5), by(group) 
prtest d0 if group!=1 & (politics_scale_profile_update==3 | politics_scale_profile_update==5), by(group) 

prtest d0 if group!=3 & (politics_scale_profile_update<3 | politics_scale_profile_update>5), by(group) 
prtest d0 if group!=1 & (politics_scale_profile_update<3 | politics_scale_profile_update>5), by(group)




